package tpoo.client.ui.widgets;


import static tpoo.common.dto.model.NotifactionCodes.UPDATE_CONTACTS;
import java.util.Observable;
import java.util.Observer;

import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PlatformUI;

/**
 * Extiende Table Viewer, no cambia su comportamiento, solamente implementa la interfaz observer
 * Será un observer del modelo en el cliente. @see UserDTO 
 * @author diego
 *
 */
public class MyTableViewer extends TableViewer implements Observer{

	public MyTableViewer( Composite parent, int style) {
		super(parent, style);
		// TODO Auto-generated constructor stub
	}

	public void update(Observable o, Object arg) {
		if (UPDATE_CONTACTS.equals(arg))
			PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable(){
				public void run() {
					refresh();
				}
			});
	}
	
}
